// createWebHashHistory
import {createRouter, createWebHistory, createWebHashHistory} from "vue-router"
 
// 1.定义组价路由， 注意：这里一定要使用文件的全名，包含问价后缀名
import Layout from '@/layout/index.vue'

// 2.定义路配置
export const routes = [
    {
        path: '/',
        component: Layout,
        redirect: '/dashboard',
        children: [
            {
                path: '/dashboard',
                name: 'dashboard',
                component: () => import('@/views/dashboard/index.vue'),
                meta: {
                    title: '首页',
                }
            },
            {
                path: '/recommentGood',
                name: 'recommentGood',
                component: () => import('@/views/recommentGood/index.vue'),
                meta: {
                    title: '内推干货',
                },
            },
            {
                path:'/recommentGood/detail',
                name:'recommentGood-detail',
                component: () => import('@/views/recommentGood/detail.vue'),
                meta: {
                    title: '内推详情',
                    hide: true
                },
            },
            {
                path: '/aboutUs',
                name: 'aboutUs',
                component: () => import('@/views/aboutUs/index.vue'),
                meta: {
                    title: '关于我们',
                }
            },
            
        ]
    },
    
    
]

// 3.创建路由实例
const router = createRouter({
    // 4.采用hash模式
    history: createWebHashHistory(),
    // 采用history模式
    // history: createWebHistory(),
    routes, // 使用上方定义的路由配置
    // scrollBehavior (to, from , savedPosition) { //history模式
    //     if(savedPosition) {
    //         return savedPosition
    //     } else {
    //         return {x:0, y:0}
    //     }
    // }
})

export default router